import requests


url = ('https://api.bilibili.com/x/web-interface/wbi/index/top/feed/rcmd?web_location=1430650&y_num=4'
       '&fresh_type=4&feed_version=V8&fetch_row=10&fresh_idx=5&device=win&homepage_ver=1'
       '&ps=12')
# ps = 3 表示刷新的数据条数

heads = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36',
    'referer': 'https://www.bilibili.com/v/popular/rank/anime'
}
response = requests.get(url,headers=heads)


for data in response.json()['data']['item']:
       img_url = data['pic']
       title = data['title']
       print(img_url,title)